package cn.zkdcloud.novel;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * the schedule of Chapter update, default speed : 1 min
 *
 * @author zk
 * @version 2017/9/29
 */
@Component
public class NovelSchedule {

    private NovelUtil novelUtil = new NovelUtil();

    @Scheduled(initialDelay = 1, fixedDelay = 18000000)
    public void doSchedule() {
        for (Novel novel : NovelUtil.novelList) {
            if (!novelUtil.isLatest(novel)) { // is latest chapter?
                NovelUtil.pushUpdate(novel);
            }
        }
    }

}
